<?php

namespace app\api\model\user;

use app\api\model\UserModel;
use app\logic\model\user\UserMusicApplyLogicModel;
use app\logic\single\GoodsSingle;

class UserMusicApplyApiModel extends UserMusicApplyLogicModel
{
    public function getApiList(array $param, string $field='*', $page=1, $limit=15,string $order='id desc')
    {
        $query=$this
            ->where(function ($q) use ($param){
                if(check_request($param,'user_id')){
                    $q->where("user_id",$param['user_id']);
                }
                if(check_request($param,'audit')){
                    $q->where("audit",$param['audit']);
                }
            });
        $list = $query->field($field)->order($order)
            ->page($page,$limit)->select();
        $count = $query->count();
        return [$list,$count];
    }
}